#include<func.h>
//完成端口的主机及网络字节序的来回转换
int main()
{
    uint16_t port=0x1234,nport;
    nport=htons(port);//将主机字节序转换成网络字节序
    printf("nport=%x\n",nport);
    port=0;
    port=ntohs(nport);//将网络字节序转换成主机字节序
    printf("port=%x\n",port);
    return 0;
}